﻿/*This script goes on a MC and counts down to an event then executes code.
It uses getTimer which isn't alway the most reliable method but it works.*/

onClipEvent (load) {
        wait = 5;
        starTimer = true;
}
onClipEvent (enterFrame) {
        if (starTimer) {
                if (startTime == undefined) {
                        startTime = getTimer()/1000;
                }
                curTime = getTimer()/1000;
                if ((curTime-startTime)>=wait) {
                        starTimer = false;
                        delete startTime;
                        // actions to do after time is up
                        trace ("bing!");
                } else {
                        _root.timeRemaining = wait-(curTime-startTime);
                }
        }
}

//To get it to start counting down, just set movieClipName.startTimer = true;